package come.tool.utilEnum;


public enum AnswerEnum {
	
    A(0, "孙悟空的第一个师父是__。","A：唐僧,B：如来,C：菩提祖师,D：老G","C：菩提祖师"),
	B(1, "猪八戒原本在天庭的官职是__。","A：天蓬元帅,B：卷帘大将,C：弼马温,D：二狼真菌","A：天蓬元帅"),
	C(2, "沙和尚原本在天庭的官职是__。","A：天蓬元帅,B：卷帘大将,C：托塔天王,D：玉皇大帝","B：卷帘大将"),
	D(3, "取经成功后，孙悟空被封为__。","A：净坛使者,B：斗战胜佛,C：金身罗汉,D：王母娘娘","B：斗战胜佛"),
	E(4, "下列妖怪中，不是从天庭下凡的是__。","A：金角大王,B：银角大王,C：白骨精,D：老G","C：白骨精"),
	F(5, "下列元素中，原子序数最大的是__。","A：氧(O),B：碳(C),C：铁(Fe),D：铜(Cu)","C：铁(Fe)");

    private final int value;
    private final String topic;
    private final String option;
    private final String answer;

    AnswerEnum(int value, String topic, String option, String answer) {
        this.value = value;
        this.topic = topic;
        this.option = option;
        this.answer = answer;
    }

    public int getValue() {
        return value;
    }

    public String getAnswer() {
		return answer;
	}
    
	public String getTopic() {
		return topic;
	}

	public String getOption() {
		return option;
	}

	// 根据值获取名称
    public static String getNameByValue(int value) {
        for (AnswerEnum equipment : AnswerEnum.values()) {
            if (equipment.getValue() == value) {
                return equipment.name();
            }
        }
        return null;
    }

    // 根据值获取描述
    public static String getDescriptionByValue(int value) {
        for (AnswerEnum equipment : AnswerEnum.values()) {
            if (equipment.getValue() == value) {
                return equipment.getAnswer();
            }
        }
        return null;
    }
    /**
     * 获取选项
     * @param value
     * @return
     */
    public static String getOption(int value) {
    	for (AnswerEnum equipment : AnswerEnum.values()) {
    		if (equipment.getValue() == value) {
    			return equipment.getOption();
    		}
    	}
    	return null;
    }
    /**
     * 获取正确答案
     * @param value
     * @return
     */
    public static String getAnswer(int value) {
    	for (AnswerEnum equipment : AnswerEnum.values()) {
    		if (equipment.getValue() == value) {
    			return equipment.getAnswer();
    		}
    	}
    	return null;
    }
    /**
     * 获取题目
     * @param value
     * @return
     */
    public static String getTopic(int value) {
    	for (AnswerEnum equipment : AnswerEnum.values()) {
    		if (equipment.getValue() == value) {
    			return equipment.getTopic();
    		}
    	}
    	return null;
    }
}
